package com.smedi.ismedi.constructionproject.core.infrastructure.handler;

import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler;
import com.smedi.ismedi.constructionproject.core.infrastructure.constant.ConstantField;
import lombok.extern.slf4j.Slf4j;
import net.sf.jsqlparser.expression.Expression;
import net.sf.jsqlparser.expression.StringValue;

@Slf4j
public class TopOrgIdHandler implements TenantLineHandler {
    @Override
    public Expression getTenantId() {
        log.debug("生成topOrgId...");
        String userTenantId = "001"; // + (new Random().nextInt(2) + 1);
        return new StringValue(userTenantId);
    }

    @Override
    public String getTenantIdColumn() {
        return ConstantField.topOrgId;
    }

    @Override
    public boolean ignoreTable(String tableName) {
        return TenantLineHandler.super.ignoreTable(tableName);
    }
}
